package com.yuke.cloud.service.pmc.controller.frontend;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.yuke.cloud.common.core.support.BaseController;
import com.yuke.cloud.common.util.wrapper.WrapMapper;
import com.yuke.cloud.common.util.wrapper.Wrapper;
import com.yuke.cloud.service.pmc.entity.ProdSpecPicture;
import com.yuke.cloud.service.pmc.service.ProdSpecPictureService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

/**
* Created by zys on 2018/09/27.
*/
@Slf4j
@Api(value = "WEB - ProdSpecPictureController", tags = "处理ProdSpecPicture相关请求", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@RestController
@RequestMapping("/mall/prod/spec_picture")
public class MallProdSpecPictureController extends BaseController {
    @Resource
    private ProdSpecPictureService prodSpecPictureService;

    @GetMapping("/app/spec/{specId}")
    @ApiOperation(httpMethod = "GET", value = "根据ID获取商品所有图片信息")
    public Wrapper<List<ProdSpecPicture>> detailBySpecId(@ApiParam(name = "specId", value = "specId") @PathVariable Long specId) {
        List<Long> list = new ArrayList<>();
        list.add(specId);
        List<ProdSpecPicture> prodSpecPictures = prodSpecPictureService.getProdSpecPicBySpecIds(list);
        return WrapMapper.ok(prodSpecPictures);
    }
}

